////----程序清单14-9  ShowImage.java----
package chapter.chapter14;

import javafx.application.Application;
import javafx.stage.Stage;
import javafx.scene.Scene;
import javafx.scene.layout.Pane;
import javafx.scene.layout.HBox;
import javafx.geometry.Insets;
import javafx.scene.image.Image;
import javafx.scene.image.ImageView;

public class ShowImage extends Application {
	@Override // Override the start method in the Application class
	public void start(Stage primaryStage) {
		// Create a pane to hold the image views
		Pane pane = new HBox(10);//节点放在水平行中。 新的子节点附加到右侧的末尾。参数为图像之间间距
		//默认情况下。行高度设置为子节点的最大首选高度。
		//默认情况下，每个子节点与左上位置对齐
		pane.setPadding(new Insets(15, 5, 5, 5));//定义面板内边距top、right、bottom、left
		Image image = new Image("image/us.gif");
		
		pane.getChildren().add(new ImageView(image));

		ImageView imageView2 = new ImageView(image);
		imageView2.setFitHeight(100);
		imageView2.setFitWidth(100);
		pane.getChildren().add(imageView2);
		//参数必须是Node及其子类对象，Image类对象不是，所以不能直接添加Image类对象
		ImageView imageView3 = new ImageView(image);
		//imageView3.setRotate(90);
		pane.getChildren().add(imageView3);

		// Create a scene and place it in the stage
		Scene scene = new Scene(pane);
		primaryStage.setTitle("Show Image"); // Set the stage title
		primaryStage.setScene(scene); // Place the scene in the stage
		primaryStage.show(); // Display the stage
	}
	/**
	 * The main method is only needed for the IDE with limited JavaFX support. Not
	 * needed for running from the command line.
	 */
	public static void main(String[] args) {
		Application.launch(args);
	}
}
